<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <!--<link rel="stylesheet" type="text/css" href="bootstrap.min.css"/>-->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <style>
    	.helloworld>.col-xs-12{
    		min-height:40px;
    		line-height:40px;
    	}
    	.bluelable{
    		display: inline-block;
    		width: 5px;
    		height:20px;
    		background-color: green;
    		vertical-align: middle;
    		margin-right: 10px;
    	}
    	.hh{
    		margin-top: 20px;
    		margin-bottom: 20px;
    	}
		.alert{
			display: none;
		}
    </style>
</head>
<body>
<div>
    <div class="container-fluid">
		<div class="alert alert-danger " id="alert1">姓名不能为空。</div>
		<div class="alert alert-danger" id="alert2">电话号码错误。</div>


		<div class="row">
            <div class="col-xs-6 row helloworld">
            	<div class="col-xs-11 col-xs-offset-1 hh"><span class="bluelable"></span>基本信息</div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">会员姓名</div>
		            <div class="col-xs-9">
		                <input type="text"  class="form-control" id="username" value="<?php echo $member['username'];?>" placeholder="例如'张三'">
		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">会员电话</div>
		            <div class="col-xs-9">
		                <input type="text" class="form-control" id="usertel" value="<?php echo $member['usertel'];?>" placeholder="例如'商户名称'">
		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">性别</div>
		            <div class="col-xs-9">
		                <select  class="form-control" id="sex">
		                	<option value="0" <?php if($member['sex']==false){echo 'selected="selected"';}?> >保密</option>
		                	<option value="1" <?php if($member['sex']==1){echo 'selected="selected"';}?> >男</option>
		                	<option value="2" <?php if($member['sex']==2){echo 'selected="selected"';}?> >女</option>
		                </select>
		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">会员分组</div>
		            <div class="col-xs-9">
		            	<select  class="form-control" id="usergroup">
		                	<option value="0" <?php if($member['sex']==false){echo 'selected="selected"';}?> >默认分组</option>
		                </select>
		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">OpenID</div>
		            <div class="col-xs-9">
						<?php echo $member['openid'];?>
		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">会员ID</div>
		            <div class="col-xs-9" id="userid">
												<?php echo $member['id'];?>

		            </div>
		        </div>
		       	<div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">微信昵称</div>
		            <div class="col-xs-9">
												<?php echo $member['nickname'];?>

		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">注册时间</div>
		            <div class="col-xs-9">
				<?php echo date("Y-m-d H:m:s",$member['createtime']);?>		           
		            
		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">会员来源</div>
		            <div class="col-xs-9">
						<?php if($member['from']==false):?>微信注册<?php endif;?>
		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">生日</div>
		            <div class="col-xs-9">
				<?php echo date("Y-m-d H:m:s",$member['shengri']);?>		           
		            </div>
		        </div>
		        <div class="col-xs-12 row">
		            <div class="col-xs-2 col-xs-offset-1">推广人员</div>
		            <div class="col-xs-9">
						门店收银台
		            </div>
		        </div>
           </div>
        	<div class="col-xs-6 row">
        		<div class="col-xs-11 col-xs-offset-1 hh"><span class="bluelable"></span>会员卡</div>
        		<div class="helloworld">
					<div class="col-xs-12 row">
						<div class="col-xs-2 col-xs-offset-1">
							[卡1]
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
					<div class="col-xs-12 row">
						<div class="col-xs-3">
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
					<div class="col-xs-12 row">
						<div class="col-xs-3">
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
        		</div>
        		<div class="helloworld">
					<div class="col-xs-12 row">
						<div class="col-xs-2 col-xs-offset-1">
							[卡1]
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
					<div class="col-xs-12 row">
						<div class="col-xs-3">
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
					<div class="col-xs-12 row">
						<div class="col-xs-3">
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
        		</div>
        		        		<div class="helloworld">
					<div class="col-xs-12 row">
						<div class="col-xs-2 col-xs-offset-1">
							[卡1]
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
					<div class="col-xs-12 row">
						<div class="col-xs-3">
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
					<div class="col-xs-12 row">
						<div class="col-xs-3">
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
        		</div>
        		<div class="helloworld">
					<div class="col-xs-12 row">
						<div class="col-xs-2 col-xs-offset-1">
							[卡1]
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
					<div class="col-xs-12 row">
						<div class="col-xs-3">
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
					<div class="col-xs-12 row">
						<div class="col-xs-3">
						</div>
						<div class="col-xs-3">
							会员卡名称
						</div>
						<div class="col-xs-6">
							饭萌梦游卡
						</div>
					</div>
        		</div>
           </div>
            <div class="col-xs-12 text-center" style="margin-top: 30px;">
                <button class="btn btn-danger" id="save" style="margin-right: 20px;">保存</button>
                <button class="btn btn-success" id="del">删除</button>
            </div>
        </div>
    </div>
</div>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/layer/3.0.1/layer.min.js"></script>

<script>
	$("#save").on('click',function () {
	    if($('.row').find('#userid').text().length>0) {
            var li = "{:url('index/card/memberedit')}?id=" + $('.row').find('#userid').text();
        }else{
            var li="{:url('index/card/memberedit')}";

		}
		if($(".row").find("#username").val().length==0){

$("#alert1").show();
return false;
	    }
        if($(".row").find("#usertel").val().length==0){

            $("#alert2").show();
            return false;
        }

		$.ajax({
			url:li,
			data:{
				method:"0",
                username:$(".row").find("#username").val(),
                usertel:$("#usertel").val(),
                usergroup:$("#usergroup").val(),
				sex:$("#sex").val()





			},
			dataType:"json",
			type:"post",
			success:function (ret) {
                layer.alert(ret.msg);
			//	location.href=history.go(-2);
	//		window.parse().href=location.reload()
				setTimeout(function () {
                    window.parent.location.reload(); //刷新父页面

                },1000)

            }





		})





    })
	$("#del").on("click",function () {
        if($('.row').find('#userid').text().length>0) {
            var li = "{:url('index/card/memberedit')}?id=" + $('.row').find('#userid').text();
        }else{
           alert("错误")

        }


        $.ajax({
            url:li,
            data:{
                method:"1",





            },
            dataType:"json",
            type:"post",
            success:function (ret) {
                alert(ret.msg);
                location.href=history.go(-1);



            }





        })



    })



</script>
</body>
</html>